Skip to content

Max time - #152

Merged
sylvinus merged 7 commits into
masterfrom
max-time
Feb 20, 2017
Merged

Max time#152
sylvinus merged 7 commits into
masterfrom
max-time

Conversation

@mehdigmira

Copy link
Copy Markdown
Contributor

Comment thread mrq/worker.py Outdated
self.done_jobs = 0
self.max_jobs = self.config["max_jobs"]
max_time = self.config.get("max_time")
self.max_time = datetime.timedelta(seconds=max_time) if max_time is not None else None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

à priori max_time sera toujours défini (comme il est dans la config) donc le .get() et le test sur None sont inutiles

Comment thread mrq/config.py Outdated

parser.add_argument(
'--max_time',
default=0,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pas très grave, mais plutôt float ?

Comment thread tests/test_interrupts.py Outdated
def test_worker_interrupt_after_max_time(worker):
worker.start(flags="--greenlets=2 --max_time=1", queues="test1 default")

worker.send_tasks("tests.tasks.general.Add", [{"a": i, "b": 1, "sleep": 1} for i in range(5)], block=False)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

j'aurais bien fait max_time=2 & sleep=3 pour être sûrs des timings

Comment thread tests/test_interrupts.py Outdated

worker.send_tasks("tests.tasks.general.Add", [{"a": i, "b": 1, "sleep": 1} for i in range(5)], block=False)

time.sleep(3)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

et du coup ici sleep(5)

Comment thread tests/test_interrupts.py Outdated
assert Queue("default").size() == 3


def test_worker_runs_but_interrupt_after_max_time(worker):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pas bien compris ce que ca teste comparé au précédent ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ca récupère juste le résultat pour vérifier qu'il a été bien calculé

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

je combinerais bien les 2 en un seul alors

@sylvinus

Copy link
Copy Markdown
Contributor

Looks great!

@sylvinus
sylvinus merged commit 2d808c6 into master Feb 20, 2017
sylvinus added a commit that referenced this pull request Mar 19, 2017
* 'master' of github.com:pricingassistant/mrq:
  requirement update
  Max time (#152)
  more info on workers (#151)
  Save abort traceback (#149)
sylvinus added a commit that referenced this pull request Mar 27, 2017
* master:
  test API routes
  fix typo preventing traceback retrieval
  avoid filters being overriden
  Fix missing commits in 0.2.1
  MRQ 0.2.0
  requirement update
  Max time (#152)
  more info on workers (#151)
  Save abort traceback (#149)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants